﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>员工管理</title>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	
	<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
	
	<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
	<script type="text/javascript">
	  $(function(){
	    // alert("页面加载函数");
	     querys(1);
	     
	     $("#query").click(function(){
	        
	        querys(1);
	     });
	     
	     //分页加动作
		   $("body").on("click","#pagediv li a",function(){
		
		     var pp = $(this).attr("name");
		   
		     querys(pp);
		     });
		     
		    //页面加载显示所有部门
		     $.getJSON("dept/list.action","",function(res){
		        //alert("部门："+res.length);
		        for(var i=0;i<res.length;i++)
		        {
		            $("#dep").append("<option value='"+res[i].de_id+"'>"+res[i].de_name+"</option>");
		        }
		     });
		     
	  });
	  function toTime(timestamp) {
		   var date = new Date(timestamp);
		   Y = date.getFullYear() + '-';
		   M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
		   D = date.getDate() + ' ';
		   h = date.getHours() + ':';
		   m = (date.getMinutes() < 10 ? '0'+(date.getMinutes()) : date.getMinutes()) + ':';
		   s = (date.getSeconds() < 10 ? '0'+(date.getSeconds()) : date.getSeconds());
		   return Y+M+D+h+m+s;
		}
	  function querys(pp)
	  {
	    var str=$("#queryform").serialize()+"&page="+pp;
	   // alert(str);
	    $.getJSON("emp/dellist.action",str,function(pbean){
	        $("#empbody").html("");
	       for(var i=0;i<pbean.list.length;i++)
	       {
	         var emp=pbean.list[i];
	        
	         var trs=$("<tr class='text-c'></tr>");
	        
	         trs.append("<td>"+emp.us_id+"</td>");
	         trs.append("<td><u style='cursor:pointer;text-decoration:none;' class='text-primary' onclick=\"member_show('"+emp.us_name+"','emp/getbyid.action?n=1&id="+emp.us_id+"','10001','360','400')\">"+emp.us_name+"</u></td>");
	         trs.append("<td width='40'>"+emp.a_id.ar_sex+"</td>");
	         trs.append("<td>"+emp.us_phone+"</td>");
	         trs.append("<td>"+emp.a_id.ar_email+"</td>");
	         trs.append("<td class='text-l'>"+emp.a_id.ar_country+"  "+emp.a_id.ar_province+"  "+emp.a_id.ar_city+"</td>");
	         trs.append("<td>"+toTime(emp.a_id.intime)+"</td>");
	         trs.append("<td class='td-status'><span class='label label-success radius'>"+emp.a_id.ar_status+"</span></td>"); 
	         trs.append("<td class='td-manage'>"+
						    "<a title='恢复' href='javascript:;' onclick=\"member_del2('"+emp.us_id+"')\" class='ml-5' style='text-decoration:none'>"+
						       "<i class='Hui-iconfont'>&#xe6df;</i>"+
						    "</a></td>");
	         $("#empbody").append(trs);
	       }
	        $("#pagediv").html("");
	        $("#count").html("");
	        $("#count").append("共有数据：<strong>"+pbean.totalRow+"</strong> 条");
	        $("#pagediv").append("<span>共"+pbean.totalRow+"条记录，当前显示第&nbsp;"+pbean.currpage+"&nbsp;页</div>");
	        var newul=$("<ul style='float:right;'></ul>");
	        //上一页
	         
	          newul.append("<li style='float:left;'><a href='javascript:void(0)' name='"+(pbean.currpage-1)+"' class='btn btn-primary radius'><span class='pagepre'><</span></a></li>");
	        
	        for( var i=1;i<=pbean.totalpage;i++)
	        {
	           newul.append("<li style='float:left;padding:5px;'><a href='javascript:void(0)' name='"+i+"'>&nbsp;"+i+"&nbsp;</a></li>");
	        }
	        
	        //下一页
	       
	         newul.append(" <li style='float:left;'><a href='javascript:void(0)'  name='"+(pbean.currpage+1)+"' class='btn btn-primary radius'><span class='pagenxt'>></span></a></li>");
	        $("#pagediv").append(newul);
		       
	       
	    });
	  }
	  
	</script>
	
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户中心 <span class="c-gray en">&gt;</span> 用户管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
 <form id="queryform">
		部门：<select name="depid" id="dep" class="input-text" style="width:200px" >
		        <option value="0">--请选择一个部门--</option>
		     </select>
		姓名：<input type="text" name="name" class="input-text" style="width:120px" />
	      
	      <script src="js/area.js" type="text/javascript" ></script>
		所在省份：
			
				<select id="province" class="input-text" style="width:200px"  size="1" name="province" onchange="doProvAndCityRelation();" >
                  <option id="choosePro" value="">请选择您所在省份</option>
                </select>
		所在城市：
				<select id="citys" class="select" size="1" name="city" class="input-text" style="width:200px"  >
                  <option id='chooseCity' value=''>请选择您所在城市</option>
                 </select>
		<button type="button" class="btn btn-success radius" id="query" name=""><i class="Hui-iconfont">&#xe665;</i> 搜用户</button>
	  </form>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
	   <span class="r" id="count"></span> </div>
	<div class="mt-20">
	<table class="table table-border table-bordered table-hover table-bg">
		<thead>
			<tr class="text-c">
				
				<th width="80">ID</th>
				<th width="100">用户名</th>
				<th width="40">性别</th>
				<th width="90">手机</th>
				<th width="150">邮箱</th>
				<th width="">地址</th>
				<th width="130">加入时间</th>
				<th width="70">状态</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody id="empbody">
		
		</tbody>
	</table>
	</div>
	<div id="pagediv"></div>
</div>



<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">

	function member_del2(id){
	    if(confirm("你确定要恢复此员工吗？"))
	    {
	        location="emp/huifu.action?id="+id;
	    }
	}
</script> 
</body>
</html>